import proto from '../proto/ProtoMsgV1_pb.js';
import ProtobufEncoder from '../code/ProtobufEncoder.js';

const MsgReceiveAckBuilder = {
	build: function(appId, from, to, sessionId, msgId) {		
		// 原消息
		let protoObj = new proto.Message();
		protoObj.setType(proto.HeadType.MESSAGE_RECEIVE_ACK);
		protoObj.setSequence(1);
		protoObj.setSessionId(sessionId);
		protoObj.setAppId(appId)
		
		let receiveAck = new proto.MessageReceiveAck();
		receiveAck.setMsgId(msgId);
		receiveAck.setFrom(from);
		receiveAck.setTo(to);

		protoObj.setMessageReceiveAck(receiveAck);
		
		const encode = ProtobufEncoder.encode(protoObj);
		
		return encode;
	}
}

export default MsgReceiveAckBuilder;